import request from '@/utils/request'
import type { ApiResponse } from '../index'
import type { Service } from '@/types/service'

interface CreateServiceParams {
  name: string
  description: string
  type: string
  price: number
  city: string
  address: string
  contactInfo: string
  details: string
  imageUrl: string
}

export const userServiceApi = {
  // 获取我的服务列表
  getMyServices() {
    return request.get<ApiResponse<Service[]>>('/user/services')
  },
  
  // 创建服务
  create(data: CreateServiceParams) {
    return request.post<ApiResponse<Service>>('/user/services', data)
  },
  
  // 更新服务
  update(id: number, data: Partial<CreateServiceParams>) {
    return request.put<ApiResponse<Service>>(`/user/services/${id}`, data)
  },
  
  // 删除服务
  delete(id: number) {
    return request.delete<ApiResponse>(`/user/services/${id}`)
  }
} 